<?php

class Process_model extends CI_Model {

    function __construct() {
        parent::__construct();
        // $this->load->helper('url');    
        //parent::Model(); 
    }

    function getUrl($id) {
        $this->db->select('*');
        $this->db->from('short_url');
        $this->db->where('short_url', $id);
        $query = $this->db->get();
        //echo $this->db->last_query();
        return $query->result();
        //$www = $value->long_url;
        //echo $www;
       // die;
        //header('location:$www');
    }

    function saveUrl($data) {

        $this->db->set($data);
        $this->db->insert('track_url');
        //$id = $this->db->insert_id();
        $this->db->last_query();
        return;
    }
    
    function saveIP($data) {
        //$ip=$data['ip'];
        $this->db->set($data);
        $this->db->insert('ip_detail');
        //$id = $this->db->insert_id();
        //$this->db->last_query();
        return;
    }
    function checkIP($data) {
        $ip=$data->ip;
        $this->db->select('*');
        $this->db->from('ip_detail');
        $this->db->where('ip', $ip);
        $query = $this->db->get();
        //echo $this -> db -> last_query();
        return count($query->result());
    }
    
    

}

?>
